<?php 
if(KT!='KhiThe') exit;
class intros_model extends khithe_mysql{

    public function get_cat_intro($CID)
    {
        $row = NULL;
        $CID= parent::checkStrMySQL($CID);

        $qr = " SELECT ID,TitlePage FROM ". categorys ." WHERE  ID = '".$CID."' ";
        $row = parent::mysql_fetch_one_rows($qr);

        return $row;
    }

    public function get_intro($CID)
    {
        $row = NULL;
        $CID= parent::checkStrMySQL($CID);

        $qr = " SELECT * FROM ". intros ." WHERE  CID = '".$CID."' ";
        $row = parent::mysql_fetch_one_rows($qr);

        return $row;
    }


    public function insert_intro($arr)
    {
        $row = NULL;
        $CID= parent::checkStrMySQL($arr['ID']);
        $FullContents= parent::checkStrMySQL($arr['FullContents']);

        $qr = " INSERT INTO ".intros."(CID,FullContents)VALUES('".$CID."','".$FullContents."')";
        $row = parent::UpdateInsertMySQL($qr);

        return $row;
    }

    public function update_intro($arr)
    {
        $row = NULL;
        $CID= parent::checkStrMySQL($arr['ID']);
        $FullContents= parent::checkStrMySQL($arr['FullContents']);

        $qr = "UPDATE ".intros." SET FullContents = '".$FullContents."' WHERE CID = '".$CID."' ";
        $row = parent::UpdateInsertMySQL($qr);

        return $row;
    }

}
?>